/**
    Copyright 2015 Table Rider
    By: Richard Solti & Kristoffer Dahl
*/

#include "Definitions.h"
#ifndef MOTOR_H
#define MOTOR_H

#define PPM  98.39979575915521438631

class Motor
{
public:
    Motor(int);
    virtual ~Motor();
    void setDuty(int);
    void setAcceleration(int);
    void setBrake(int);
    void setDirection(int);
    void setSleep(int);
    /*double getSpeed();*/
    int getEncoder();
    int getCurrent();
	int getLeft();
    double getRealCurrent();
    void accel(int direct);

protected:
private:
    volatile int left;
    int dDuty, cDuty, deltaDuty;//Desired, current and max change of duty
	unsigned int *ENCODER, *CURRENT, *DUTY;
   /*unsigned int oldEnc;
   clock_t timer;*/
	//RoReg ENCODER, CURRENT;
	//WoReg DUTY;
    int DIRECTION;
    int period;
};

#endif // MOTOR_H
